(ns cljsso-client.routes
  (:require [compojure.core :refer [defroutes GET]]
            [cljsso-client.middleware.sso :as sso]
            [noir.util.route :refer (def-restricted-routes)]
            [noir.session :as session]
            [sparrows.cypher :refer :all]
            [cljsso-client.config :refer [props]]
            [cljsso-client.middleware.sso :as sso]
            ))


(defn sso-map
  "Returns a map with keys `:sso-logout-url` and `:ticket`"
  []
  {:sso-logout-url sso/sso-logout-url
   :ticket         (session/get :sso-key)})


;; Routes
(defroutes sso-routes
  ;; SSO logout handler
  (GET "/logout" req (sso/sso-logout-handler req)))
